package com.apollo.demo.controller;

import com.apollo.demo.dao.PlusMapper;
import com.apollo.demo.exception.NotImplementedException;
import com.apollo.demo.model.ScoreCollection;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 教师表接口类
 */
@Api(value = "教师表", tags = "教师表接口模块")
@RestController
@RequestMapping("/teacher")
@ResponseBody
public class TeacherController {

    @Autowired
    private PlusMapper plusMapper;

    /**
     * 根据考试编号和课程编号获取各年级成绩统计信息
     */
    @ApiOperation(value = "查询课程成绩统计信息", notes = "根据考试编号和课程编号获取各年级成绩统计信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cid", value = "课程编号", required = true, dataType = "String"),
            @ApiImplicitParam(name = "eid", value = "考试编号", required = true, dataType = "String")
    })
    @GetMapping(value = "getScoresByCidAndEid")
    public ScoreCollection getScoresByCidAndEid(@RequestParam(name = "cid") String cid, @RequestParam(name = "eid") String eid) throws Exception {
        ScoreCollection scoreCollection = plusMapper.getScoresByCidAndEid(cid, eid);
        return scoreCollection;
    }

    /**
     * 根据考试编号和课程编号获取年级成绩前两名学生
     */
    @ApiOperation(value = "查询课程成绩前两名学生", notes = "根据考试编号和课程编号获取年级成绩前两名学生")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cid", value = "课程编号", required = true, dataType = "String"),
            @ApiImplicitParam(name = "eid", value = "考试编号", required = true, dataType = "String")
    })
    @GetMapping(value = "getTop2ByCidAndEid")
    public ScoreCollection getTop2ByCidAndEid(@RequestParam(name = "cid") String cid, @RequestParam(name = "eid") String eid) throws Exception {
        throw new NotImplementedException("getTop2ByCidAndEid");
    }
}